import { fromJS } from 'immutable';
import * as constants from './constants';

const defaultState = fromJS({
  webApi: [],
  preview: {},
  config: {},
});

export default(state=defaultState, action) => {
  switch(action.type){
    case constants.GET_API_CONFIG:
      return state.set('webApi',action.webApi);
    case constants.GET_PREVIEW:
      return state.set('preview',action.preview);
    case constants.GET_CON:
      return state.set('config',action.config);
    default: return state;
  }
}